package com.fancy.learncenter.utils;

import android.net.Uri;

import com.fancy.learncenter.common.Constant;
import com.jph.takephoto.model.CropOptions;

import java.io.File;

/**
 * Created by Hyy on 2016/11/2.
 */
public class Utils {
    public static Uri getCutPicPath() {
        File tfile = new File(Constant.PIC_PATH);
        if (!tfile.exists()) {
            try {
                tfile.mkdirs();
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {

        }
        return Uri.fromFile(new File(Constant.PIC_PATH + System.currentTimeMillis() + ".jpg"));
    }

    public static CropOptions getCutPicCropOptions() {
        int height = Integer.parseInt("800");
        int width = Integer.parseInt("800");
        boolean withWonCrop = false;
        CropOptions.Builder builder = new CropOptions.Builder();
        builder.setAspectX(width).setAspectY(height);
        builder.setWithOwnCrop(withWonCrop);


        return builder.create();
    }

}
